package com.rfid.emergencywarehouse.adapter;

import android.text.SpannableString;
import android.text.style.UnderlineSpan;
import android.view.View;

import com.rfid.emergencywarehouse.R;
import com.rfid.emergencywarehouse.entity.BarcodeInfo;

import java.util.List;

public class ReturnAssetAdapter extends MutilChoiceScanBarCodeAdapter{
    public ReturnAssetAdapter(List<BarcodeInfo> data) {
        super(data);
    }

    @Override
    protected void bindView(MyHolder holder, int position, BarcodeInfo t) {
        super.bindView(holder, position, t);
        holder.name.setText("物料名称：" + t.getMaterialName());
        holder.model.setText("物料型号：" + t.getSkuModel());
        holder.wg_status.setText("外观状态：" + t.getShapeStatus());
        holder.status.setText("物料是否可再次使用：" + (t.isEnable()?"是":"否"));
        holder.materialCategoryName.setText("物料分类：" + t.getMaterialCategoryName());
        holder.barcode.setText( t.getBarcode());
        SpannableString content = new SpannableString("外观编辑");
        content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
        holder.edit_wg.setText(content);
        holder.edit_wg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mListener != null) {
                    mListener.onEdit(t);
                }
            }
        });
    }

    @Override
    protected int getLayout() {
        return R.layout.item_return;
    }
}
